package com.kafka.kafkatest.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;

/**
 * 启动初始化
 */
@Component
public class InitConfig implements ApplicationRunner {

    @Autowired
    private RedisTemplate redisTemplate;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        //初始化缓存里面AIGC数据量
        ValueOperations operations = redisTemplate.opsForValue();
        operations.set("num",0);
    }
}
